using System;

namespace SubversionReports.Entities
{
    public class RepositoryCredential
    {
        private Guid id;
        private string rootUrl;
        private string username;
        private string password;

        /// <summary>
        /// Gets or sets the id.
        /// </summary>
        /// <value>The id.</value>
        public Guid Id
        {
            get { return id; }
            set { id = value; }
        }

        /// <summary>
        /// Gets or sets the root URL.
        /// </summary>
        /// <value>The root URL.</value>
        public string RootUrl
        {
            get { return rootUrl; }
            set { rootUrl = value; }
        }

        /// <summary>
        /// Gets or sets the username.
        /// </summary>
        /// <value>The username.</value>
        public string Username
        {
            get { return username; }
            set { username = value; }
        }

        /// <summary>
        /// Gets or sets the password.
        /// </summary>
        /// <value>The password.</value>
        public string Password
        {
            get { return password; }
            set { password = value; }
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="RepositoryCredential"/> class.
        /// </summary>
        /// <param name="rootUrl">The root URL.</param>
        public RepositoryCredential(string rootUrl)
        {
            id = Guid.NewGuid();
            this.rootUrl = rootUrl;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="RepositoryCredential"/> class.
        /// </summary>
        /// <param name="rootUrl">The root URL.</param>
        /// <param name="username">The username.</param>
        /// <param name="password">The password.</param>
        public RepositoryCredential(string rootUrl, string username, string password) : this(rootUrl)
        {
            this.username = username;
            this.password = password;
        }
    }
}
